package com.ycz.pattern.behaviour.commandpattern;

import com.ycz.pattern.behaviour.strategypattern.OprationAdd;

import java.util.ArrayList;
import java.util.List;

/**
 * @author yancz
 * @ClassName Broker
 * @description: TODO
 * @date 2023-11-28 17:43:07
 * @version: 1.0
 */
public class Broker {

    private List<Order> orderList = new ArrayList<>();

    public void takeOrder(Order order) {
        orderList.add(order);
    }

    public void placeOrders() {
        for(Order order:orderList) {
            order.execute();
        }
        orderList.clear();
    }

}
